package com.ddm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 一级指标表
 * </p>
 *
 * @author 丁丁猫
 * @since 2025-01-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Level1对象", description = "一级指标表")
public class Level1 implements Serializable, BaseLevel {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "一级指标表id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "标准表id")
    private Long standardId;

    @ApiModelProperty(value = "唯一识别符")
    private String numId;

    @ApiModelProperty(value = "级数")
    private Long level;

    @ApiModelProperty(value = "指标名称")
    private String name;

    @ApiModelProperty(value = "详细内容")
    private String content;

    @ApiModelProperty(value = "图片url")
    private String image;

    @ApiModelProperty(value = "是否存在下一级0否1是(默认为0)")
    private Long ifNextLevel;

    @TableField(exist = false)
    private List<Level2> level2;

    public List<Level2> getLevel2() {
        if (level2 == null) {
            level2 = new ArrayList<>();
        }
        return level2;
    }

    public void setLevel2(List<Level2> level2) {
        if (CollectionUtils.isNotEmpty(level2)) {
            this.level2 = new ArrayList<>();
            this.level2.addAll(level2);
        }
    }
}
